<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ .Site.Title }} - {{ .Title }}</title>
    <style>
        /* 基础样式 */
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 0;
            color: #333;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        .hero {
            background-size: cover;
            background-position: center;
            padding: 80px 20px;
            color: white;
            text-align: center;
            margin-bottom: 40px;
        }
        .content-section {
            margin-bottom: 40px;
        }
        .section-title {
            border-bottom: 2px solid #eee;
            padding-bottom: 10px;
            margin-bottom: 20px;
            color: #2c3e50;
        }
        .content-links {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }
        .content-card {
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 20px;
            transition: transform 0.3s ease;
        }
        .content-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        .content-card h3 {
            margin-top: 0;
            color: #2c3e50;
        }
        .content-card a {
            text-decoration: none;
            color: inherit;
        }
    </style>
</head>
<body>
    <main>
        <!-- Hero 区域 -->
        {{ with .Params.banner }}
        <section class="hero" style="background-image: url('{{ .image }}')">
            <div class="container">
                <h1>{{ $.Title }}</h1>
                <div class="content">
                    {{ $.Content }}
                </div>
            </div>
        </section>
        {{ end }}

        <!-- 精选文章区域 -->
        <section class="featured-posts container">
            <h2 class="section-title">精选内容</h2>
            <div class="content-links">
                {{ range first 3 (where .Site.RegularPages "Params.featured" true) }}
                <div class="content-card">
                    <a href="{{ .RelPermalink }}">
                        <h3>{{ .Title }}</h3>
                        <p>{{ .Description | default .Summary }}</p>
                    </a>
                </div>
                {{ end }}
            </div>
        </section>

        <!-- 按分类分组的内容区域 -->
        <div class="container">
            <!-- 获取所有有内容的分类 -->
            {{ $sections := where .Site.Sections "Pages" "!=" nil }}
            
            {{ range $sections }}
            <section class="content-section">
                <h2 class="section-title">{{ .Title | humanize | title }}</h2>
                <div class="content-links">
                    {{ range .Pages }}
                    <div class="content-card">
                        <a href="{{ .RelPermalink }}">
                            <h3>{{ .Title }}</h3>
                            <p>{{ .Description | default (truncate 100 .Summary) }}</p>
                            {{ with .Params.date }}<small>发布日期: {{ .Format "2006-01-02" }}</small>{{ end }}
                        </a>
                    </div>
                    {{ end }}
                </div>
            </section>
            {{ end }}
        </div>
    </main>
</body>
</html>